Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-util-route-handler

Package Overview
Dependencies
Maintainers
23
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-util-route-handler

Cloudflare Route Handler Util

  • 4.2.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
23
Weekly downloads
 
Created
Source

cf-util-route-handler

Cloudflare Route Handler Util

Installation

$ npm install cf-util-route-handler

Usage

import {handleRoutes, routeTo} from 'cf-util-route-handler';
import Backbone from 'backbone';

// setup the router
handleRoutes(function(url) {
  Backbone.history.navigate(url, true);
});

// do all the world to make the router work normally
new Backbone.Router({
  routes: {
    ''    : () => console.log('/'),
    hello : () => console.log('/hello'),
    world : () => console.log('/world')
  }
});
Backbone.history.start();

// start routing
routeTo('/');
routeTo('/hello');
routeTo('/world');

A handler looks like this:

handleRoutes(url => {
  takeActionWithUrl(url);
});

Only one handler is allowed to be setup.

routeTo is fire and forget, there's no callback for async transitions, and it does not return anything.

FAQs

Package last updated on 28 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc